home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 5 / MacMania 5.toast / / Tools&Utilities / MacPerl BBEdit Extensions / read me - MacPerl extensions < prev    next >
Text File  |  1996-08-14  |  9KB  |  213 lines

  1. BBEdit Extensions for MacPerl
  2. =============================
  3.  
  4. by Brad Hanson (bhanson@avalon.net, BradH5@aol.com)
  5. August 14, 1996
  6.  
  7. The package contains four BBEdit extensions that facilitate the use of BBEdit as
  8. an external editor for MacPerl. MacPerl is a Macintosh port of the Perl
  9. programming language by Matthias Neeracher. Information about MacPerl is
  10. available at
  11.    http://err.ethz.ch/members/neeri/macintosh/perl-qa.html
  12.  
  13. The latest versions of these extensions will be available at
  14.    ftp://users.aol.com/bradh5/MacPerl_BBEdit_extensions.sit
  15.  
  16. The four extensions included are: 1) Run MacPerl, 2) Run MacPerl Front, 3) Run
  17. File with MacPerl, and 4) Edit MacPerl Script. These extensions are independent
  18. of one another and any of them can be installed without the others. To install an
  19. extension put it in the "BBEdit Extensions" folder that is in the same folder as
  20. the BBEdit application. If BBEdit is running the extension will only appear in
  21. the Extensions menu after BBEdit is quit and restarted. A command key can be
  22. assigned to the BBEdit extension by using the "Set Keys" item in the BBEdit
  23. Extensions menu.
  24.  
  25. These extensions are 68K BBEdit extensions and should work on a 68K or
  26. PowerPC Macintosh with MacPerl 4 or 5, and BBEdit (version 3.5 or later) or
  27. BBEdit Lite (version 3.0.1 or later). The extensions require Macintosh system
  28. software version 7.0 or later. These extensions are freeware. If you have
  29. any questions or comments, or would like a copy of the source code, please let me
  30. know. I thank Matthias Neeracher for his assistance in the design of the
  31. Run File with MacPerl and Edit MacPerl Script extensions.
  32.  
  33. Descriptions of each of the four extensions are given below.
  34.  
  35. Run MacPerl
  36. -----------
  37.  
  38. This extension sends the text in the active BBEdit window to MacPerl to be
  39. executed as a Perl script. If a Perl script executed by the extension writes
  40. output to STDOUT or STDERR then a new BBEdit window is created and the output is
  41. put into the new window after the script is finished executing (any STDERR text
  42. is first followed by the STDOUT text). MacPerl must be running before the
  43. extension is executed, otherwise an alert is displayed. Typing the command and
  44. period keys together will terminate the extension, although the Perl script
  45. started by the extension will still be running.
  46.  
  47. A limitation of the extension is that any MacPerl specific functions contained in
  48. a Perl script that put up a dialog (such as MacPerl::Choose or MacPerl::Ask) will
  49. not function properly. This is because BBEdit is the active application when the
  50. extension is run and the MacPerl functions that put up a dialog expect MacPerl to
  51. be the active application. Another limitation is that the extension will not work
  52. with scripts that use STDIN. The Run MacPerl Front extension described below can
  53. be used to run scripts containing MacPerl commands that put up a dialog or use
  54. STDIN.
  55.  
  56. Run MacPerl Front
  57. -----------------
  58.  
  59. When this extension is run MacPerl is brought to the front, and the contents
  60. of the active BBEdit window are sent to MacPerl to be executed as though
  61. run using the Run Script command in MacPerl (e.g., STDOUT is sent to the MacPerl
  62. STDOUT window rather than to a new BBEdit window). This extension can be used to
  63. run any script that can be run directly with MacPerl, whereas there are some
  64. scripts (e.g., those that use STDIN) that will not work with the Run MacPerl
  65. extension described above.
  66.  
  67. One small problem is that after the extension is run and BBEdit is switched
  68. to the background the front BBEdit window is not fully deactivated (e.g.,
  69. the scroll bars will appear active and the insertion point will still blink).
  70. This appears to be a cosmetic problem - BBEdit will continue to operate
  71. normally when it is brought back to the front.
  72.  
  73. Run File with MacPerl
  74. ---------------------
  75.  
  76. When this extension is executed a standard file dialog is displayed to select
  77. a file to be sent to MacPerl to be executed as a Perl script. The extension
  78. functions identically to the "Run MacPerl" extension with the exception that
  79. the Perl script to be executed is contained in a file selected from a
  80. standard file dialog rather than the active BBEdit window.
  81.  
  82. Edit MacPerl Script
  83. -------------------
  84.  
  85. When this extension is executed a standard file dialog is displayed to select a
  86. file to be edited in BBEdit. This extension is useful for editing Perl scripts
  87. in file types that cannot be edited normally by BBEdit (runtimes, droplets,
  88. etc.), although the extension can also be used to edit normal text files. This
  89. extension requires MacPerl 5.1.0r2 or later.
  90.  
  91. After the extension is executed, and a file selected from the standard file
  92. dialog, the Perl script contained in the file will be displayed in a new BBEdit
  93. window. To save changes made to the text in the BBEdit window MacPerl needs to be
  94. given a command to update the file. In BBEdit versions  4.0 and later the update
  95. command is given automatically when the file is saved. This extension is most
  96. useful if used with version 4.0 or later of BBEdit, although it can be used with
  97. BBEdit version 3.5 and BBEdit Lite version 3.0.1 or later.
  98.  
  99. In BBEdit version 3.5 and BBEdit Lite the update command must be given by
  100. switching to MacPerl and selecting Update from the BBEdit menu (the BBEdit menu
  101. will be present if Internet Config version 1.2 is installed and BBEdit has been
  102. chosen as the editor helper application). If the BBEdit window is saved and
  103. closed without telling MacPerl to update it, the original file will not be
  104. updated. If a window is closed without updating, the original file can still be
  105. updated by choosing Update… from the BBEdit menu in MacPerl. The original file
  106. should appear in the list of files that can be updated.
  107.  
  108. Tips
  109. ----
  110.  
  111. A useful tip for using MacPerl with BBEdit that it is possible to use ResEdit to
  112. modify the MacPerl application so that the files created by a Perl script will
  113. have BBEdit as the creator (rather than MPW). Open the MacPerl application with
  114. ResEdit and open the resource of type GU∑I (there should be one resource of this
  115. type). The field named "Creator of created files" contains a four character
  116. application signature. Change the text of this field to R*ch (the application
  117. signature of BBEdit) and save the modified MacPerl application.
  118.  
  119. With the Run MacPerl and Run MacPerl Front extensions the syntax of a script
  120. can be checked by putting "#!perl -c" (without the quotes) as the first line 
  121. of the script. To run the script remove the "-c" from the first line.
  122.  
  123. Of related interest is the BBEdit Script Extension for MacPerl written by
  124. Matthias Neeracher. This allows Perl scripts to be saved as BBEdit extensions by
  125. MacPerl. There is a Perl interface to BBEdit that allows MacPerl scripts saved as
  126. BBEdit extensions to use BBEdit extension callbacks. Unfortunately, the last time
  127. I checked (using the 07Feb96 version of the BBEdit Script Extension with MacPerl
  128. 5.0.6) the BBEdit extension callbacks did not work on 68000 Macintoshes (they do
  129. work on PowerPC Macintoshes). The BBEdit Script Extension for MacPerl is
  130. available from
  131.     <ftp://err.ethz.ch/pub/neeri/MacPerl/MPBBEdit_07Feb96.sit.bin>
  132.  
  133.  
  134. Version History of Run MacPerl
  135. ------------------------------
  136.  
  137. July 14, 1996 - Version 1.0.2
  138.  
  139. - Routine descriptors are disposed of (this should have no effect 
  140.   on the current 68K extension).
  141.  
  142.  
  143. July 7, 1996 - Version 1.0.1
  144.  
  145. - Minor changes to allow the source code to be shared with other
  146.   extensions. The extension should function identically to Version 1.0.
  147.  
  148. - Changed name from Run Perl Script to Run MacPerl.
  149.  
  150.  
  151. April 15, 1996 - Version 1.0
  152.  
  153. - Pressing command-period will stop the extension.
  154.  
  155. - Added alerts for more informative error messages.
  156.  
  157. - Added version resource.
  158.  
  159.  
  160. January, 1996 - Version 0 (actually no version number)
  161.  
  162. I submitted this initial version to the MacPerl mailing list.
  163.  
  164.  
  165. Version History of Run MacPerl Front
  166. ------------------------------------
  167.  
  168. July 14, 1996 - Version 1.0.2
  169.  
  170. - The switch to MacPerl is now done as the last step if no errors
  171.   have occurred. Routine descriptors are disposed of (this should
  172.   have no effect on the current 68K extension). Should function 
  173.   identically to Version 1.0.
  174.  
  175.  
  176. July 10, 1996 - Version 1.0.1
  177.  
  178. - Exactly the same as Version 1.0 except for the version number. 
  179.   I created this by mistake and sent it to a few people.
  180.   
  181.  
  182. July 10, 1996 - Version 1.0
  183.  
  184. - Initial version. Distributed to MacPerl mailing list.
  185.  
  186.  
  187. Version History of Run File from MacPerl
  188. ----------------------------------------
  189.  
  190. July 14, 1996 - Version 1.0.1
  191.  
  192. - Routine descriptors are disposed of (this should have no effect 
  193.   on the current 68K extension).
  194.  
  195.  
  196. July 7, 1996 - Version 1.0
  197.  
  198. - Initial version.
  199.  
  200.  
  201. Version History of Edit MacPerl Script
  202. --------------------------------------
  203.  
  204. July 14, 1996 - Version 1.0.1
  205.  
  206. - Routine descriptors are disposed of (this should have no effect 
  207.   on the current 68K extension).
  208.  
  209.  
  210. July 7, 1996 - Version 1.0
  211.  
  212. - Initial version.
  213.